/*
 *   Copyright (c) 2010-2022, SIUFUNG
 */
package net.siufung.market.base.tenant.controller.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import net.siufung.core.model.AbstractDto;
import net.siufung.core.utils.CopyUtil;
import net.siufung.market.base.tenant.mapper.entity.TenantType;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
/**
 * <p>
 * 系统租户类型表 新增数据传参对象
 * </p>
 * @author 陈建峰
 * @since 2022-07-06 14:45:08
 */
@Slf4j
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TenantTypeSaveDto", description="系统租户类型表新增数据传参对象")
public class TenantTypeSaveDto extends AbstractDto {

    private static final long serialVersionUID = -3938902450957694488L;

    /**
     * 类型名称
     */
    @ApiModelProperty(value = "类型名称")
    @NotBlank(message = "类型名称不能为空!")
    @Length(max=64, message="类型名称长度不大于64!")
    private String name;

    /**
     * 类型编码
     */
    @ApiModelProperty(value = "类型编码")
    @NotBlank(message = "类型编码不能为空!")
    @Length(max=64, message="类型编码长度不大于64!")
    private String code;

    /**
     * 描述
     */
    @ApiModelProperty(value = "描述")
    @Length(max=255, message="描述长度不大于255!")
    private String description;


    /**
     * TenantType 转化成 TenantTypeSaveDto 数据领域实体
     * @return TenantType
     */
    public TenantType to(){
        TenantType tenantType = new TenantType();
        CopyUtil.copyProperties(this, tenantType);
        return tenantType;
    }
}